/*
*
*人员模块请求的url接口
*
*/
angular.module("personnelmanagementS", ["Common"]).service('RequestPopService', ['Restangular', '$rootScope', function (Restangular, $rootScope) {



      //人员档案--班级考勤记录
      this.getGradeSign = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getGradeSign", params);
    };
    //人员档案--任务的学习记录
    this.getArrangeReport = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getArrangeReport", params);
    };
    //人员档案--年度学习报表
    this.getReportYear = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getReportYear", params);
    };
    //人员档案--考试记录
    this.getExam = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getExam", params);
    };
    //人员档案--学习记录
    this.getAsynchronous = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getAsynchronous", params);
    };
    //人员档案
    this.getReportTotle = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getReportTotle", params);
    };

    


     //人员档案--考试记录
    this.getExam = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getExam", params);
    };
    //人员档案--学习记录
    this.getAsynchronous = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getAsynchronous", params);
    };
    //人员档案
    this.getdetaileds = function (params) {
        return Restangular.one("studentfile").customPOST({ name: "My Message" }, "getdetaileds", params);
    };
    //查询专家列表（选择器）
    this.findExpert = function (params) {
        return Restangular.one("specialColumn").customPOST({ name: "My Message" }, "findExpert", params);
    };
    
    /**********************学员注册********************************/
    this.studentReg = function (params) {
        return Restangular.one("ApiUser").customPOST({ name: "My Message" }, "studentReg", params);
    };
    /********************运营首页**************************/
    //获取企业
    this.searchOrgList = function (params) {
        return Restangular.one("Operate").customPOST({ name: "My Message" }, "searchOrgList", params);
    };
    //删除人员统计的文件
    this.delPerson = function (params) {
        return Restangular.one("PersonnelManagement").customPOST({ name: "My Message" }, "delPerson", params);
    };
    /*****************************************************/
    //验证企业名称是否存在
    this.searchOrgByName = function (params) {
        return Restangular.one("Operate").customPOST({ name: "My Message" }, "searchOrgByName", params);
    };
    this.GetLoginDateLog = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetLoginDateLog", params);
    }
    // 导入列表
    this.GetImportList = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetImportList", params);
    },
    // 人员列表
    this.personnelGetList = function (params) {
        return Restangular.one("PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelGetList", params);
    },
    // 人员删除
    this.personnelGetPersonList = function (params) {
        return Restangular.one("PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelGetPersonList", params);
    }
    // 人员删除
    this.personnelDel = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelDel", params);
    }
    // 人员编辑获取
    this.personnelGetKey = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelGetKey", params);
    }
    // 人员添加编辑
    this.personnelAddEdit = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelAddEdit", params);
    }
    // 人员编辑--日志修改
    this.personnelLogUpdate = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelLogUpdate", params);
    }
    // 人员编辑 -- 日志新增
    this.personnelLogAdd = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelLogAdd", params);
    }
    // 人员编辑-- 日志获取
    this.personnelLogGetList = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelLogGetList", params);
    }
    // 人员编辑-- 日志删除
    this.personnelLogDel = function (params) {
        return Restangular.one("/PersonnelManagement").customPOST({ name: "My Message" }, "PersonnelLogDel", params);
    }
    //人员选择器--人员列表
    this.personnelUser = function (params) {
        return Restangular.one('PersonnelSelector').customPOST({ name: "My Message" }, "PersonnelUser", params);
    }
    // 人员选择器 -- 组织机构
    this.personnelOrg = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "PersonnelOrg", params);
    }
    // 人员选择器-- 用户组
    this.personnelGroup = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "PersonnelGroup", params);
    }
    // 人员选择器--角色
    this.personnelRole = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "PersonnelRole", params);
    }

    // 组织结构、权限、用户组获取排序码
    this.GetSort = function (params) {
        return Restangular.one('PersonnelSelector').customPOST({ name: "My Message" }, "GetSort", params);
    }

    //用户组--删除
    this.DelGroup = function (params) {
        return Restangular.one('PersonnelSelector').customPOST({ name: "My Message" }, "DelGroup", params);
    }

    //用户组--添加、修改
    this.AddEditGroup = function (params) {
        return Restangular.one('PersonnelSelector').customPOST({ name: "My Message" }, "AddEditGroup", params);
    }

    //用户组--单条记录获取
    this.GetGroup = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetGroupPerson", params);
    }


    //组织机构--单条记录获取
    this.GetOrg = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetOrgPerson", params);
    }

    //组织机构--删除
    this.DelOrg = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "DelOrg", params);
    }

    //组织机构--添加、修改
    this.AddEditOrg = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "AddEditOrg", params);
    }

    //角色--单条记录获取
    this.GetRole = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetRolePerson", params);
    }

    //角色--删除
    this.DelRole = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "DelRole", params);
    }

    //角色--添加、修改
    this.AddEditRole = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "AddEditRole", params);
    }

    //根据传入的id获取返回的权限字符串
    this.GetAuthority = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetAuthority", params);
    }

    this.AddInfoAndTask = function (params) {
        return Restangular.one("CommunCenter").customPOST({ name: "My Message" }, "AddInfoAndTask", params);
    }

    //根据多少userid查询用户列表
    this.GetUsersList = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetUsersList", params);
    }

    //获取人数
    this.GetPersonnelCount = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "GetCount", params);
    }


    //修改子节点数量
    this.SetChildNode = function (params) {
        return Restangular.one("PersonnelSelector").customPOST({ name: "My Message" }, "SetChildNode", params);
    }


    //生成密钥对
    this.randomRSAKey = function (params) {
        return Restangular.one("api").customPOST({ name: "My Message" }, "randomRSAKey", params);
    }
    //根据orgId找到公钥
    this.findRSAPubKey = function (params) {
        return Restangular.one("api").customPOST({ name: "My Message" }, "findRSAPubKey", params);
    }
    //解除用户锁定
    this.clearlock = function (params) {
        return Restangular.one("ApiUser").customPOST({ name: "My Message" }, "clearlock", params);
    }

    //http://192.168.1.182/api/randomRSAKey?orgId=xxxx&userID=xxxx
    //http://192.168.1.182/api/findRSAPubKey?orgId=xxxx

    /***运营图表***/

    //获取优秀教师统计排名信息
    this.findStatisticsRankByExTeacher = function (params) {
        return Restangular.one("EnterpriseStatistics").customPOST({ name: "My Message" }, "findStatisticsRankByExTeacher", params);
    }

    //    获取课程观看量统计排名信息
    this.findStatisticsRankByCourse = function (params) {
        return Restangular.one("EnterpriseStatistics").customPOST({ name: "My Message" }, "findStatisticsRankByCourse", params);
    }

    //    获取企业活跃度统计排名信息
    this.findStatisticsRankByCompanyActivity = function (params) {
        return Restangular.one("EnterpriseStatistics").customPOST({ name: "My Message" }, "findStatisticsRankByCompanyActivity", params);
    }
    //    获取项目访问活跃度趋势
    this.findStatisticsRankByProActivity = function (params) {
        return Restangular.one("EnterpriseStatistics").customPOST({ name: "My Message" }, "findStatisticsRankByProActivity", params);
    }
    //    获取部门活跃度统计排名
    this.findBaseDepartmentActivity = function (params) {
        return Restangular.one("EnterpriseStatistics").customPOST({ name: "My Message" }, "findBaseDepartmentActivity", params);
    }

    //课程模板生成
    /*
    course_id：课程编号 ID 
    */
    this.courseGeneratingTemplate = function (params) {
        return Restangular.one("course").customPOST({ name: "My Message" }, "courseGeneratingTemplate", params);
    }
    //人员离职列表
    /*
    */
    this.findDimissionRecordInfo = function (params) {
        return Restangular.one("dimissionRecord").customPOST({ name: "My Message" }, "findDimissionRecordInfo", params);
    }
    //人员复职
    /*
    */
    this.conductRestoration = function (params) {
        return Restangular.one("dimissionRecord").customPOST({ name: "My Message" }, "conductRestoration", params);
    }
    //获取人员结业信息
    /*
    */
    this.getDimissionUserInfo = function (params) {
        return Restangular.one("dimissionRecord").customPOST({ name: "My Message" }, "getDimissionUserInfo", params);
    }
    //删除离职人员
    /*
    */
    this.deleteDimissionUser = function (params) {
        return Restangular.one("dimissionRecord").customPOST({ name: "My Message" }, "deleteDimissionUser", params);
    }
    //保存结业人员
    /*
    */
    this.modifyDimissionUserInfo = function (params) {
        return Restangular.one("dimissionRecord").customPOST({ name: "My Message" }, "modifyDimissionUserInfo", params);
    }

   
} ]);


















////用户登录
//function login() {
//    var username = $("#username").val();
//    var passwd = $("#passwd").val()
//    $.post("/ApiUser/login", { username: username, passwd: passwd, code: "" },
//        function (data2) {
//            var users = eval(data2);
//            //用户登录错误次数 >5 <10 显示验证码 ，>10 锁定帐号
//            // errorcode  0登录成功 11账号被锁定1小时 12账户或密码有错误 13该用户已经登录 5连接不上数据库 14验证码错误
//            //                    console.log(users.name);
//            if (users.errorcode == "11") {
//                $("#error1").text("账号被锁定1小时！");
//            } else if (users.errorcode == "13") {
//                $("#error1").text("该用户已经登录！");
//            } else if (users.errorcode == "5") {
//                $("#error1").text("连接不上数据库！");
//            } else if (users.errorcode == "14") {
//                $("#error1").text("验证码错误！");
//            } else if (users.errorcode == "6") {
//                $("#error1").text("系统错误！");
//            } else if (users.errorcode == "28") {
//                $("#error1").text("系统错误1！");
//            } else if (users.errorcode == "12") {
//                if (users.errnum >= 5 && users.errnum < 10) {
//                    //                            $scope.errnum5 = true;
//                    //                            $scope.verify_div = true;
//                    //                            $scope.upd_yzm();
//                } else if (users.errnum >= 10) {
//                    //                            $scope.upd_yzm();
//                    //                            $scope.verify_div = true;
//                    //                            $scope.errnum5 = false;
//                    //                            $scope.errnum10 = true;
//                    //                            $scope.logindis = true;
//                } else {
//                    if (users.errnum <= 1) {
//                        $.post("/ApiUser/isAccount", { useraccount: username },
//                        function (data1) {
//                            var retData = eval(data1);
//                            //验证帐号是否存在
//                            if (retData.errorcode == "4") {
//                                $("#error1").text("帐号不存在，请重新输入！");
//                            } else {
//                                $("#error1").text("用户名或密码错误, 请重新输入！");
//                            }
//                        });
//                    } else {
//                        $("#error1").text("用户名或密码错误, 请重新输入！");
//                    }
//                }
//            } else if (users.errorcode == "0") {
//                if (users.data.userstate == "0") {
//                    if (users.data.powerLV == 99) {//学员登录                                
//                        $.post("/slogin/login_pwd", { username: username, passwd: passwd },
//                        function (data) {
//                            if (data == 2) {
//                                var liveid = "";
//                                if (liveid.length > 0) {
//                                    location.href = "/slogin/joinlive?liveid=&uid=&uname=" + encodeURI("");
//                                    return;
//                                }
//                                location.href = "/slogin/mains";
//                            } else {
//                                $("#error1").text("账号密码错误");
//                            }
//                        }).error(function () { alert("服务器，异常。请联系管理员"); });
//                    } else {
//                        console.log("登录成功！");
//                        console.log(users.data);
//                        sysUserInfo.setuserinfo(users.data);
//                        window.location.href = "/system/index.html";
//                    }
//                } else if (users.data.userstate == "1") {
//                    console.log("帐号未激活！");
//                    console.log(users.data);
//                    sysUserInfo.setuserinfo(users.data);
//                    window.location.href = "/system/index.html";
//                } else if (users.data.userstate == "2") {
//                    console.log("帐号锁定！");
//                }
//            }
//        })
//    //.error(function () { alert("服务器，异常。请联系管理员"); });
//}
